import request from '@/util/util';
import JSEncrypt from 'jsencrypt';

export async function login(body: API.LoginParams) {
    // 由服务端提供的RSA加密公钥，如果服务端更新私钥，此处需一并更新
    const {password} = body;
    const pubKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcazXY2ZKrFrPXE1xTMkIE/wDjiLkofksspG/vV1y3sLxfetbz/GVGfzvPIFEWNLACyppZWbtOLWN+umIERab08vfzMdPq1jTkW311cbjgh2Lq+b4DcFThAA+bipXudrO3DUNLR+6q51dBLyVAvdCWKGNYMcnjVPsnhX46F88VuQIDAQAB';
    const encrypt = new JSEncrypt({});
    encrypt.setPublicKey(pubKey);
    body.password = `${encrypt.encrypt(password)}_encrypted`;
    return request.post('/api/login/securityLogin', body);
}


//获取菜单
export async function getMenu() {
    return request.get('https://api.weipaitang.com/wechat/v1.0/twoyuan/get-two-yuan-list');
}



